const app = getApp();
var config = app.globalData.config;
const http = require('../../utils/http.js');

Page({
	data: {
		chooseid: -1,
		dataList: []
	},
	choose(e) { //选择状态
		this.setData({
			chooseid: e.currentTarget.dataset.id
		});
		this.getLeaveDinner();
	},
	onShow(options) {
		this.getLeaveDinner();
	},
	getLeaveDinner() {
    var that = this;
    http.httpPost(config.dinnerApprovalList, {
      student_name : that.data.studentName,
			status: that.data.chooseid
		}, function(e) {
      that.setData({
        dataList : e.data
      })
		});
	},
	//搜索
	searchFun(e) {
		var searchName = e.detail.value;
		this.setData({
			studentName: searchName
		});
		this.getLeaveDinner();
	},

	onReady() {
		if (!app.login()) {
			return;
		}
	}
})
